package com.lyb.controller;

import com.lyb.common.AjaxResult;
import com.lyb.pojo.Permission;
import com.lyb.pojo.Role;
import com.lyb.services.impl.PermissionServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/permission")
public class PermissionC {
    @Autowired
    PermissionServiceImpl permissionService;
    @PostMapping("/update")
    public AjaxResult update(@RequestBody Permission permission){
        permissionService.update(permission);
        return AjaxResult.success("操作成功");
    }
    @DeleteMapping("/del")
    public AjaxResult del(Long id){
        permissionService.del(id);
        return AjaxResult.success("操作成功");
    }
    @GetMapping("/queryPage")
    public AjaxResult queryPage(Integer pageSize, Integer pageNum){
        return AjaxResult.success(permissionService.queryPage(pageSize,pageNum));
    }
    @PostMapping("/add")
    public AjaxResult add(@RequestBody Permission permission){
        permissionService.add(permission);
        return AjaxResult.success("操作成功");
    }
}
